﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SharpICTCLAS;
using DisposeText;

namespace DisposeText
{
    public partial class Form1 : Form
    {
        private StringSolve stringSolve;

        public Form1()
        {
            InitializeComponent();
            stringSolve = new StringSolve(@"ICTCLAS_Data");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int positiveCount = stringSolve.GetWordsLengthFromTextByFeature(txtContent.Text.Trim(),WordFeature.Positive);
            int negativeCount = stringSolve.GetWordsLengthFromTextByFeature(txtContent.Text.Trim(),WordFeature.Negative);
            if (positiveCount >= negativeCount)
            {
                MessageBox.Show("积极的");
            }
            else
            {
                MessageBox.Show("消极的");
            }
            MessageBox.Show(stringSolve.ProcessTextWithColors(txtContent.Text.Trim()));
            
            string positive = null;
            string negative = null;

            foreach (Word word in stringSolve.GetWordsFromTextByFeature(txtContent.Text.Trim(), WordFeature.Positive))
            {
                positive += word.ToString();
                positive += " ";
            }
            MessageBox.Show("积极词汇如下:"+positive);

            foreach (Word word in stringSolve.GetWordsFromTextByFeature(txtContent.Text.Trim(), WordFeature.Negative))
            {
                negative += word.ToString();
                negative += " ";
            }
            //MessageBox.Show("消极词汇如下:" + negative);
        }
 
    }
}
